<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>物流信息</title>
<%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
<style type="text/css">
div.col-sm-2.text-left, div.col-sm-3.text-left{
    color:#949494;
    }

#process {
	margin: 50px;
	padding: 25px 0 80px;
}

#process .node, #process .proce {
	float: left;
	position: relative;
	height: 18px;
	background-image: url(../../lib/img/bg_state.jpg);
	background-repeat: no-repeat;
}

#process .node.ready {
	width: 13px;
	background-position: -150px 0px;
}

#process .node.doing {
	width: 13px;
	background-position: -150px -60px;
}

#process .node.wait {
	width: 13px;
	background-position: -150px -40px;
}

#process .proce {
	width: 150px;
}

#process .proce.doing {
	background-position: 0 -20px;
	color: #360;
}

#process .proce.wait {
	background-position: 0 -40px;
	color: #360;
}

ul {
	display: inline-block;
	list-style: none;
}

#process ul {
	padding-top: 18px; /*margin-left: -152px;*/
	margin-left: -190px;
	display: inline-block;
	margin-top: 0px;
	position: absolute;
	width: 314px;
	text-align: center;
	list-style: none;
}

#process .proce ul {
	z-index: 5;
	width: 150px;
}

#process .node ul {
	z-index: 1;
	width: 275px;
	margin-left: -125px;
}

#Logistics li {
	padding: 5px 0px;
}

#process .tx2 {
	color: #999;
	line-height: 15px;
}

#OrderInfo {
	margin: 5px;
	border: 0px;
	width: 95%;
}

#OrderInfo th {
	background-color: #FFFCEB;
	text-align: right;
	width: 120px;
}

#OrderInfo td {
	text-align: left;
}

#processexplain div {
	float: right;
	height: 18px;
	background-image: url(../../lib/img/bg_state.jpg);
	background-repeat: no-repeat;
	padding-left: 16px;
	margin-right: 20px;
}
/*增加，否则ie6有问题*/
* html #process .node {
	background-position-x: -150px;
}

* html #process .proce {
	background-position-x: 0;
}

* html #process .wait {
	background-position-y: -40px;
}

* html #process .doing {
	background-position-y: -20px;
}

* html #process .ready {
	background-position-y: 0;
}

* html #process .singular {
	background-position-y: -60px;
}
/*ff*/
#process .node ul {
	z-index: 1;
	width: 200px;
	margin-left: -125px;
}
/* ie8+*/
#process .node ul {
	z-index: 1\9;
	width: 200px\9;
	margin-left: -125px\9;
}
/*ie6 7 特殊处理*/
#process .node ul {
	*z-index: 1;
	*width: 200px;
	*margin-left: -90px;
}
/*google*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
	#process .node ul {
		z-index: 1;
		width: 200px;
		margin-left: -125px;
	}
}
</style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
	<section class="content-header">
	<h1>药品合并</h1>
	<ol class="breadcrumb">
		<li><a href="../../home.html"><i class="fa fa-home"></i>药械采购</a></li>
		<li class="active"><a href="compList.jsp">药品库</a></li>
		<li class="active"><a href="#">药品合并</a></li>
	</ol>
	</section>

	<section class="content">
      <table class="infoBox">
      <tr>
        <td width="150px" class="infoBoxleft">
        <p style="color:#fff;font-size:20px;text-align:center;font-weight:600">被合并药品</p>
        </td>
        <td>
        	<form role="form" class="form-horizontal" action="${ctx }/stdDrug/editInfo.html" method="post">
                <div class="box-body">
                    <div class="form-group form-group-xs"   style="margin-top:5px;">
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">药品编码：</label>
                        <div class="col-sm-2 text-left">${form.drugCode }</div>
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">通用名：</label>
                        <div class="col-sm-2 text-left">${form.drugName }</div>
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">剂型：</label>
                        <div class="col-sm-2 text-left">${form.formName }</div>
                    </div>
                    <div class="form-group form-group-xs" style="margin-top:-10px">                        
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">规格：</label>
                        <div class="col-sm-2 text-left">${form.specName }</div>
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">转换系数：</label>
                        <div class="col-sm-2 text-left">${form.factor }</div>
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">单位：</label>
                        <div class="col-sm-2 text-left">${form.unit }</div>
                    </div>
                      
                   
                   <div class="form-group form-group-xs" style="margin-top:-10px;margin-bottom:-10px;">                       
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">材质：</label>
                        <div class="col-sm-2 text-left">${form.materialName }</div>
                        <label for="exampleInputEmail1" class="col-sm-2 text-right">生产企业：</label>
                        <div class="col-sm-3 text-left">${form.prodPompName }</div>
                        <label for="exampleInputEmail1" class="col-sm-2 text-right"></label>
                        <div class="col-sm-2 text-left"></div>
                    </div>
                </div>
             </form>
        </td>
      </tr>
      </table>  
   
		<div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                <div class="form-group form-group-xs">
                        <label >药品编码：</label>
                        <input class="form-control" type="text" id="drugCode" name="drugCode" placeholder="药品编码" />
                    </div>
                     <div class="form-group form-group-xs">
                        <label for="txtDrugName">通用名:</label>
                        <input class="form-control" type="text" id="drugName" name="drugName" placeholder="通用名" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugSpec">一级济型：</label>
                        <select id="drugform1"  class='form-control' >
                        </select>
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugName">二级济型：</label>
                        <input class="form-control" type="text" id="drugform2" placeholder="二级济型" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugName">生产企业：</label>
                        <input class="form-control" type="text" id="prodPompName" placeholder="生产企业" />
                    </div>
                    <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>

	
	<table class="jqgrid" id="gridlist"></table>
		<div id="gridpage"></div>
		<div class=" box box-warning bottongroup">
			<button type="button" onclick="merge()"
				class="btn btn-default btn-sm">合  并</button>
				<button type="button" onclick="window.location.href='${ctx}/stdDrug/list.html'"
				class="btn btn-default btn-sm">返  回</button>
		</div>

	</section>
	<%@ include file="/WEB-INF/component/commonJS.jsp" %> 
	<script type="text/javascript">
		$(function() {
			$('#addNew').click(function() {
				$('#exampleModal').modal({
					keyboard : true
				});
			});
			$('#confirmtest').click(function() {
				$.HN.message.confirm('确定不通过吗？', '', '').on(function(e) {
					if (e) {
						$.HN.message.alert('操作成功！', '提示信息', 'success');
					}
				});
			})
			$("#gridlist").jqGrid({
                url: "${pageContext.request.contextPath}/stdDrug/getValidDrugInfoList.html?drugId=${form.drugId}",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                //shrinkToFit: false,
                height: 255,
                colNames: ['drugId','药品编码', '通用名','剂型','规格','转换系数', '单位','材质', '生产企业'],
                colModel: [
							{ name: 'drugId', width: 100,hidden:true,key:true,align:"center" ,sortable: false},
							{ name: 'drugCode', width: 100,align:"center" ,sortable: false},
							{ name: 'drugName', width: 130,align:"center",sortable: false },
							{ name: 'formName', width: 60,align:"center",sortable: false },
							{ name: 'specName', width: 60,align:"center",sortable: false },
                            { name: 'factor', width: 60,align:"center",sortable: false },
                            { name: 'unit', width: 60,align:"center",sortable: false },
                            { name: 'materialName',hidden:true, width: 40,align:"center",sortable: false },
                            { name: 'prodPompName', width: 100,align:"center",sortable: false}
                ],
                rowNum: 10,
                rowList: [10, 20, 30],
                rownumbers: true,
                multiselect: true,
                pager: "#gridpage",
                viewrecords: true,
                multiselect: true,
                caption: "药品",
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
			$("#gridlist").jqGrid('navGrid', '#gridpage', {
				add : false,
				edit : false,
				del : false,
				search : false,
				refresh : false
			});
			$(window).trigger("resize");
			
			
			
			
			$("#drugform1").HNSelect({
	            url: "${pageContext.request.contextPath}/selectController/getForm.html", data: { ID: '0' },  defaultText: "<option value=''>请选择</option>"
	           
	        });
		});

		function getNumChekBox(cellvalue, options, rowObject) {
			var str = "<input type=\"text\" name=\"drug\" value=\"\" />";
			return str;
		}
		function subOrder() {
			$.HN.message.confirm('确定生成订单吗？', '', '').on(function(e) {
				if (e) {
					window.location.href = "hospOreders.jsp";
				}
			});
		}
		function addAdress() {
			$('#exampleModal').modal({
				keyboard : true
			});
		}
		function editAdress() {
			$('#editAddr').modal({
				keyboard : true
			});
		}
		function manageAdress() {
			$('#manageAddr').modal({
				keyboard : true
			});
		}
		function merge(){
			var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
    		if (rowIds.length <= 0) {
    			$.HN.message.alert("请选择一条药品信息进行合并！", "消息", "error");
    			return;
    		} else if (rowIds.length > 1){
    			$.HN.message.alert("只能选择一条药品信息合并！", "消息", "error");
    			return;
    		}
			$.HN.message.confirm('确定合并吗？', '', '').on(function(e) {
				if (e) {
					$.post("${pageContext.request.contextPath}/stdDrug/drugInfoMerge.html", {
						drugOId : "${form.drugId}",
						drugId : rowIds[0]
		    		}, function(result) {
		    			if (result == "success") {
		    				
		    				$.HN.message.alert("保存成功！", "消息", "success");
		    				window.location.href="${pageContext.request.contextPath}/stdDrug/list.html";
		    			} else {
		    				$.HN.message.alert("保存失败！", "消息", "error");
		    			}
		    		}, "json");
				}
			});
		}
		
		function gridSerch() {
        	var drugCode = $("#drugCode").val();
        	var drugName = $("#drugName").val();
        	var drugform1 = $("#drugform1").val();
        	var drugform2 = $("#drugform2").val();
        	var prodPompName = $("#prodPompName").val();
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{"drugCode":drugCode,
    	        		"drugName":drugName,
    	        		"drugform1":drugform1,
    	        		"drugform2":drugform2,
    	        		"prodPompName":prodPompName}
    	    }).trigger("reloadGrid"); //重新载入  
    	}
	</script>
</body>
</html>